package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.api.admin.SensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController  implements SensitiveControllerApi {
    @Autowired
    private AdSensitiveService adSensitiveService;

    //敏感词查询
    @RequestMapping("list")
    @Override
    public ResponseResult findPage(@RequestBody SensitiveDto sensitiveDto) {
        return adSensitiveService.findPage(sensitiveDto);
    }

    //添加
    @PostMapping("save")
    @Override
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.add(adSensitive);
    }
    //修改
    @PostMapping("update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.edit(adSensitive);
    }
    //删除
    @GetMapping("/del/{id}")
    @Override
    public ResponseResult deleteById(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }
}
